package com.yq.testmodule.second_floor;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.request.RequestOptions;
import com.yq.testmodule.R;

import java.util.ArrayList;
import java.util.List;

import jp.wasabeef.glide.transformations.BlurTransformation;

public class TestFragment2 extends Fragment {

    private static String img = "https://th.bing.com/th/id/OIP.3n4dz5jnJat2XAthR42P9QHaEo?w=289&h=180&c=7&r=0&o=5&pid=1.7";
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_test2, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ImageView ivOne = view.findViewById(R.id.iv1);
        ImageView ivTwo = view.findViewById(R.id.iv2);
        RequestOptions op = new RequestOptions();

        List<Transformation> list = new ArrayList<>();
        list.add(new BlurTransformation(25,3));
        list.add(new RotateTransformation(180));
        MultiTransformation multiTransformation = new MultiTransformation(list);
        op.transform(multiTransformation);

        Glide.with(view).load(img)
                .apply(op)
                .into(ivOne);
        Glide.with(view).load(img).into(ivTwo);

    }


}
